import Router from 'koa-router';
import admin from './admin';
import center from './center';
import order from './order';
import seats from './seats';
import setting from './setting/setting';
import repository from './setting/repository';
import stuff from './stuff';
import survey from './survey';
import tencent from './tencent/tencentManage';
import customMenu from './tencent/customMenu';
import pay from './pay';
import autoreply from './tencent/autoreply';
import corp from './corp';
import personalizedMenu from './personalizedMenu';
import material from './tencent/material';
import cloudSpace from './tencent/cloudSpace';
import templateMsg from './tencent/templateMsg';
import fansTag from './tencent/fansTag';
import fans from './fans';
import mass from './mass';
import qrcode from './markting/qrcode';
import rank from './rankListH5/ranklist';
import poster from './markting/poster';
import smart from './markting/smart';
import fissionPoster from './markting/fissionPoster';
import award from './markting/award';
import ranking from './markting/ranking';
// import newPoster from './markting/newPoster';
import statics from './statics.js';
import func from './function.js';
import h5fission from './h5fission.js';
import complaint from './markting/complaint';
import smartVerification from './markting/smartVerification';
import smartForm from './smartForm.js';
import fengSmart from './fengSmart.js';
import snews from './snews.js';
import bargainData from './markting/bargainData.js';
import pays from './markting/pays.js';
import bargain from './markting/bargain';
import bargainH5 from './markting/bargainH5';
import assembleH5 from './markting/assembleH5';
import comany_account from './comany_account.js';
import spellGroup from './markting/spellGroup';
import groupPurchase from './markting/groupPurchase.js';

const router = new Router();
router.prefix('/api');
// 生成sessionId
router.get('/getSessionId', async ctx => {
  const sessionId = ctx.sessionId;
  console.log('ctx', ctx);
  return (ctx.body = {
    sessionId,
  });
});
// 用户登录注册
router.use('/adminUser', admin.routes(), admin.allowedMethods());
// 企业中心
router.use('/adminCenter', center.routes(), center.allowedMethods());
// 智能核销
router.use('/smartVerification', smartVerification.routes(), smartVerification.allowedMethods());
// 投诉管理
router.use('/complaint', complaint.routes(), complaint.allowedMethods());
// 员工
router.use('/stuff', stuff.routes(), stuff.allowedMethods());

router.use('/survey', survey.routes(), survey.allowedMethods());
// 公众号
router.use('/tencent', tencent.routes(), tencent.allowedMethods());
// 自定义菜单
router.use('/customMenu', customMenu.routes(), customMenu.allowedMethods());
// 坐席
router.use('/seats', seats.routes(), seats.allowedMethods());
// 订单
router.use('/order', order.routes(), order.allowedMethods());
// 支付
router.use('/pay', pay.routes(), pay.allowedMethods());
// 设置
router.use('/set', setting.routes(), setting.allowedMethods());
// 个性化菜单
router.use('/wechat', personalizedMenu.routes(), personalizedMenu.allowedMethods());
// 素材管理
router.use('/wxPublicAccount', material.routes(), material.allowedMethods());
// 素材管理 云空间
router.use('/cssWxTmpMedia', cloudSpace.routes(), cloudSpace.allowedMethods());
// 模板消息
router.use('/templateMsg', templateMsg.routes(), templateMsg.allowedMethods());
// 知识库
router.use('/repository', repository.routes(), repository.allowedMethods());
// 粉丝标签
router.use('/fansTag', fansTag.routes(), fansTag.allowedMethods());
// 自动回复
router.use('/autoreplyRule', autoreply.routes(), autoreply.allowedMethods());
// 设置》坐席、分配规则、接待组设置
router.use('/corp/item', corp.routes(), corp.allowedMethods());
router.use('/fans', fans.routes(), fans.allowedMethods());
// 群发消息
router.use('/cssGroupSending', mass.routes(), mass.allowedMethods());
// 营销 二维码
router.use('/channelQrCode', qrcode.routes(), qrcode.allowedMethods());
// 营销 海报
router.use('/posterTemplate', poster.routes(), poster.allowedMethods());
// 营销 智能接待
router.use('/intelligentReception', smart.routes(), smart.allowedMethods());
// 营销 排行榜
router.use('/rank', ranking.routes(), ranking.allowedMethods());
//  统计
router.use('/adminstatics', statics.routes(), statics.allowedMethods());
// 营销 裂变海报
router.use('/fissionPosterTemplate', fissionPoster.routes(), fissionPoster.allowedMethods());
router.use('/rank', rank.routes(), rank.allowedMethods());
router.use('/award', award.routes(), award.allowedMethods());
router.use('/bargain', bargain.routes(), bargain.allowedMethods());
// 砍价相关
router.use('/bargain', bargainData.routes(), bargainData.allowedMethods());
// 支付
router.use('/uPayOrder', pays.routes(), pays.allowedMethods());
router.use('/bargainH5', bargainH5.routes(), bargainH5.allowedMethods());
router.use('/assembleH5', assembleH5.routes(), assembleH5.allowedMethods());
// 功能
router.use('/func', func.routes(), func.allowedMethods());
// h5裂变
router.use('/fission', h5fission.routes(), h5fission.allowedMethods());
// 通知消息
router.use('/snews', snews.routes(), snews.allowedMethods());
// 智能表单
router.use('/smartForm', smartForm.routes(), func.allowedMethods());
// 冯云雷智能表单
router.use('/smartForm', fengSmart.routes(), fengSmart.allowedMethods());
// 账号
router.use('/companyAccount', comany_account.routes(), comany_account.allowedMethods());
//拼团
router.use('/spellGroup', spellGroup.routes(), spellGroup.allowedMethods());
// 拼团活动
router.use('/groupPurchase', groupPurchase.routes(), groupPurchase.allowedMethods());

export default function(app) {
  app.use(router.routes());
}
